<?php
include_once MODEL_DIR . 'activity.class.php';
$activity=new activity();

if (intval($_GET['mid'])) {
    $_SESSION['mem'] = $member->getById(intval($_GET['mid']));
}
$_SESSION['client'] = $member->getById($_SESSION['client']['id']);

switch ($param) {
    case 'thanh-vien':
        $action = trim($_GET['action']);

        if ($member->checkLogin()) {
            switch ($action) {
                case 'guithu':

                    include INCLUDE_DIR . "header_popup.php";
                    include "views/member-send.php";
                    include INCLUDE_DIR . "footer_popup.php";
                    break;
                case 'hopthu':

                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-inbox.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'thudagui':

                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-sent.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'thongtincanhan':
                    include_once MODEL_DIR . 'geographic.class.php';
                    $geo = new geographic();
                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-view-profile.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'suathongtincanhan':

                    include_once MODEL_DIR . 'geographic.class.php';
                    $geo = new geographic();
                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-edit-profile.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'doimatkhau':

                    include INCLUDE_DIR . "header.php";
                    include "views/member-changepassword.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'taianhlen':

                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-upload-image.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'upload_img':
                    include INCLUDE_DIR . "header_popup.php";
                    include "views/member-upload-image.php";
                    include INCLUDE_DIR . "footer_popup.php";
                    break;
                case 'suaalbum':

                    include INCLUDE_DIR . "header_popup.php";
                    include "views/member-edit-album.php";
                    include INCLUDE_DIR . "footer_popup.php";
                    break;
                case 'xemalbum':
                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-my-album.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'anhcuatoi':
                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-my-image.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'xemanh':

                    include_once MODEL_DIR . 'date.class.php';
                    $date_fomat = new dateFormatter();
                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-view-image.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'chinhsuaanh':

                    include_once MODEL_DIR . 'image.class.php';
                    $objImage = new image();
                    //include INCLUDE_DIR . "header.php";
                    include "views/member-edit-image.php";
                    //include INCLUDE_DIR . "footer.php";
                    break;
                case 'avatar':

                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/member-avatar.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'crop_image':

                    include INCLUDE_DIR . "header_popup.php";
                    include "views/member-crop-image.php";
                    include INCLUDE_DIR . "footer_popup.php";
                    break;
                case 'getnames':


                    include "views/member-get-names.php";

                    break;
                case 'friend':

                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';
                    include "views/friends.php";
                    include INCLUDE_DIR . "footer.php";
                    break;
                case 'addfriend':

                    include INCLUDE_DIR . "header_popup.php";
                    include "views/member-add-friend.php";
                    include INCLUDE_DIR . "footer_popup.php";
                    break;
                case 'thoat':
                    $member->logout();
                    header("Location: /dang-nhap");
                    break;
                default :
                    include_once MODEL_DIR . 'stream.class.php';
                    include_once MODEL_DIR . 'date.class.php';
                    $stream = new stream();
                    $date_fomat = new dateFormatter();

                    include INCLUDE_DIR . "header.php";
                    include_once 'views/member-topcommon.php';

                    include "views/member-home.php";

                    include INCLUDE_DIR . "footer.php";

                    break;
                    break;
            }
        } else {

            header("Location:" . DOMAIN);
        }
        die;
        break;
    case 'dang-ky':
        include INCLUDE_DIR . "header.php";
        include "views/member-register.php";
        include INCLUDE_DIR . "footer.php";
        break;
    case 'dang-nhap':
        $member->checkRememberLogin();
        $member->login();
        include INCLUDE_DIR . "header.php";

        if ($member->checkRememberLogin() && !isset($_GET['taikhoankhac'])) {
            include "views/member-login-remember.php";
        } else {
            include "views/member-login.php";
        }
        include INCLUDE_DIR . "footer.php";
        break;
    default :
        if (!isset($_SESSION['client']['id'])) {
            header("Location: /dang-nhap");
        } else {
            header("Location: /thanh-vien?mid=" . $_SESSION['client']['id']);
        }
}
?>